﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPage.Master" AutoEventWireup="true" CodeBehind="ManageArticles.aspx.cs" Inherits="DrivingCRM.Views.Private.CMS.ManageArticles" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="banniere" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="nav" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="contenu" runat="server">
    Catégorie:
    <asp:DropDownList ID="DDL_Category" runat="server" AutoPostBack="true">
        <asp:ListItem Text="Univers Auto" Value="Univers Auto" />
        <asp:ListItem Text="Univers Moto" Value="Univers Moto" />
        <asp:ListItem Text="Code de la route" Value="Code de la route" />
    </asp:DropDownList>

    <asp:ListView ID="LV_Articles" runat="server" DataKeyNames="IdArticle" 
        DataSourceID="DS_Articles"
        OnItemCanceling="LV_articles_ItemCanceling">
        <AlternatingItemTemplate>
            <td runat="server" style="background-color:#FFF8DC;">
              <table class="Table_ItemList">
                  <tr>
                    <td colspan="2" style="text-align:center"><h2><asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' /></h2></td>
                  </tr>
                  <tr> 
                    <td><asp:Literal ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' /></td>
                  </tr>
                  <tr>
                    <td style="text-align:right;"><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                        Text="Supprimer" /></td>
                    <%--<td><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Modifier" /></td>--%>
                  </tr>
               </table>
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="background-color:#008A8C;color: #FFFFFF;">
               <table class="Table_ItemList">
                    <tr>
                     <td>Titre:</td>
                     <td><asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' /></td>
                    </tr>
                    <tr>
                         <td>Contenu:</td>
                         <td>
                            <telerik:RadEditor ID="RE_Content" runat="server" Width="100%" EnableResize="false" CssClass="RadEditor">
                                <Tools>
                                    <telerik:EditorToolGroup Tag="Formatting">
                                        <telerik:EditorTool Name="Bold" />
                                        <telerik:EditorTool Name="Italic" />
                                        <telerik:EditorTool Name="Underline" />
                                        <telerik:EditorSeparator />
                                        <telerik:EditorSplitButton Name="ForeColor">
                                        </telerik:EditorSplitButton>
                                        <telerik:EditorSplitButton Name="BackColor">
                                        </telerik:EditorSplitButton>
                                        <telerik:EditorSeparator />
                                        <telerik:EditorDropDown Name="FontName">
                                        </telerik:EditorDropDown>
                                        <telerik:EditorDropDown Name="FontSize">
                                        </telerik:EditorDropDown>
                                    </telerik:EditorToolGroup>
                                </Tools>
                            </telerik:RadEditor>
                        </td>
                    </tr>
                    <tr>
                      <td>
                         <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Mettre à jour" />
                      </td>
                      <td>
                          <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Annuler" />
                      </td>
                    </tr>
                </table>
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px; width:100%;">
                <tr>
                    <td style="text-align:center;">
                        <h2>Aucun article en base.</h2></td>
                </tr>
                <%--<tr>
                     <td><asp:Button ID="B_AddArticle" runat="server" Text="Ajouter un article" OnClick="B_AddArticle_Click" /></td>
                </tr>--%>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
            <td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td runat="server" style="">
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="background-color:#DCDCDC;color: #000000;">
                <table class="Table_ItemList">
                  <tr>
                    <td colspan="2" style="text-align:center"><h2><asp:Label ID="L_Title" runat="server" Text='<%# Eval("Title") %>' /></h2></td>
                  </tr>
                  <tr> 
                    <td><asp:Literal ID="L_Content" runat="server" Text='<%# Eval("Content") %>' /></td>
                  </tr>
                  <tr>
                    <td style="text-align:right;"><asp:Button ID="DeleteButtonItem" runat="server" CommandName="Delete" 
                        Text="Supprimer" /></td>
                    <%--<td><asp:Button ID="EditButtonItem" runat="server" CommandName="Edit" Text="Modifier" /></td>--%>
                  </tr>
               </table>
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server" style="width:100%;">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;width:100%;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr><%--
                <tr runat="server">
                    <td runat="server"><asp:Button ID="B_AddArticle" runat="server" Text="Ajouter un article" OnClick="B_AddArticle_Click" /></td>
                </tr>--%>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;width:100%;">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="3">
                           <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" PreviousPageText="Précédent" FirstPageText="Première page" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" NextPageText="Suivant" LastPageText="Dernière page" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td></td>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:EntityDataSource ID="DS_Articles" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer" 
        DefaultContainerName="Model_DrivingCRMContainer" EnableDelete="True" 
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True" 
        EntitySetName="ArticleSet" EntityTypeFilter="Article"
         Where="it.Category == @SelectedCategory">
        <WhereParameters>
            <asp:ControlParameter ControlID="DDL_Category" DbType="String" Name="SelectedCategory" PropertyName="SelectedValue" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="footer" runat="server">
</asp:Content>
